package com.es.common;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 文件修改
 *
 * @author Will
 */
public class FileCache {
    private static Map<String, Object> cache = new ConcurrentHashMap<>();

    public static void addCache(String key, Long object) {
        if (containsKey(key)) {
            FileCache.cache.replace(key, object);
        } else {
            FileCache.cache.put(key, object);
        }
    }

    public static void addCache(Map<String, Long> map) {
        cache.putAll(map);
    }

    public static boolean containsKey(String key) {
        return FileCache.cache.containsKey(key);
    }

    public static Long get(String key) {
        return (Long) FileCache.cache.get(key);
    }

    public static void removeCache(String key) {
        cache.remove(key);
    }


}
